#文件操作

import pickle,os

def WriteInfo(fileName,needWriteInfo):
    fileObj=open(fileName,'w')
    info = fileObj.write('\n'+needWriteInfo)
    fileObj.close()
    print('保存：',needWriteInfo,' 到 ',fileName,' 完成')
    
def ReadInfo(fileName):
    fileObj=open(fileName,'r')
    info = fileObj.readlines()
    fileObj.close()
    return info
    
def ApendInfo(fileName,needWriteInfo):
    fileObj=open(fileName,'a')
    fileObj.write(needWriteInfo)
    fileObj.close()
    print('添加：',needWriteInfo,' 到 ',fileName,' 完成')


def WriteObj(fileName,needWriteInfo):
    fileObj=open(fileName,'wb')
    pickle.dump(needWriteInfo,fileObj)
    fileObj.close()
    print('保存：',needWriteInfo,' 到 ',fileName,' 完成')


def ReadObj(fileName):
    fileObj=open(fileName,'rb')
    info=pickle.load(fileObj)
    fileObj.close()
    print('解析：',fileName,' 文件的内容是：',info)
    return info




